package com.feng.zhihao.apigeteway.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * UserInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "USER_INFO")
public class UserInfo implements java.io.Serializable {

	// Fields

	private String userId;
	private ChannelInfo channelInfo;
	private String password;
	private String userName;
	private Set<ChannelInterface> channelInterfaces = new HashSet<ChannelInterface>(0);

	// Constructors

	/** default constructor */
	public UserInfo() {
	}

	/** minimal constructor */
	public UserInfo(String userId) {
		this.userId = userId;
	}

	/** full constructor */
	public UserInfo(String userId, ChannelInfo channelInfo, String password, String userName,
			Set<ChannelInterface> channelInterfaces) {
		this.userId = userId;
		this.channelInfo = channelInfo;
		this.password = password;
		this.userName = userName;
		this.channelInterfaces = channelInterfaces;
	}

	// Property accessors
	@Id

	@Column(name = "USER_ID", unique = true, nullable = false, length = 36)

	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CHANNEL_ID")

	public ChannelInfo getChannelInfo() {
		return this.channelInfo;
	}

	public void setChannelInfo(ChannelInfo channelInfo) {
		this.channelInfo = channelInfo;
	}

	@Column(name = "PASSWORD", length = 128)

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "USER_NAME", length = 128)

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "userInfo")

	public Set<ChannelInterface> getChannelInterfaces() {
		return this.channelInterfaces;
	}

	public void setChannelInterfaces(Set<ChannelInterface> channelInterfaces) {
		this.channelInterfaces = channelInterfaces;
	}

}